VERSION 5.00
Begin VB.Form costosParam 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Insertar Parametros"
   ClientHeight    =   5985
   ClientLeft      =   45
   ClientTop       =   420
   ClientWidth     =   6645
   BeginProperty Font 
      Name            =   "Verdana"
      Size            =   9
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5985
   ScaleWidth      =   6645
   ShowInTaskbar   =   0   'False
   Begin VB.ComboBox cmbAnali 
      Height          =   330
      ItemData        =   "costosParam.frx":0000
      Left            =   3840
      List            =   "costosParam.frx":000A
      TabIndex        =   9
      Top             =   360
      Visible         =   0   'False
      Width           =   2775
   End
   Begin VB.ComboBox cmb_ensayo 
      Height          =   330
      ItemData        =   "costosParam.frx":002D
      Left            =   3840
      List            =   "costosParam.frx":003D
      TabIndex        =   8
      Top             =   4440
      Visible         =   0   'False
      Width           =   2775
   End
   Begin VB.OptionButton opt_si 
      BackColor       =   &H00FFFFFF&
      Caption         =   "SI"
      Height          =   255
      Left            =   4080
      TabIndex        =   6
      Top             =   4080
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.OptionButton opt_no 
      BackColor       =   &H00FFFFFF&
      Caption         =   "NO"
      Height          =   255
      Left            =   4920
      TabIndex        =   5
      Top             =   4080
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.TextBox txt 
      Height          =   400
      Index           =   0
      Left            =   3840
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   4
      Top             =   720
      Width           =   2775
   End
   Begin VB.CommandButton cmdEdit 
      Caption         =   "Editar"
      Height          =   375
      Left            =   1320
      TabIndex        =   1
      Top             =   120
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "Guardar"
      Height          =   375
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
   Begin VB.Label lbl3 
      BackColor       =   &H00FFFFFF&
      Caption         =   "ANALISIS"
      Height          =   255
      Left            =   120
      TabIndex        =   10
      Top             =   500
      Visible         =   0   'False
      Width           =   2055
   End
   Begin VB.Label lbl2 
      BackColor       =   &H00FFFFFF&
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   7
      Top             =   4080
      Visible         =   0   'False
      Width           =   3725
   End
   Begin VB.Label lbl1 
      BackColor       =   &H00FFFFFF&
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   3
      Top             =   840
      Width           =   3725
   End
   Begin VB.Label lblID 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   270
      Left            =   5400
      TabIndex        =   2
      Top             =   120
      Visible         =   0   'False
      Width           =   225
   End
End
Attribute VB_Name = "costosParam"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()
Dim i As Long, j As Long
Dim aux As String
Dim numfil As Long, cont As Long
Dim linea As String


band = band
cmbAnali.ListIndex = 0 'fisicoquimico
'Por defecto no es basico
opt_no.Value = True
'por defecto bacterias
If band = 2 Then cmb_ensayo.ListIndex = 0
'si escoge microbiologico
If cmbAnali.ListIndex = 1 Then cmb_ensayo.ListIndex = 0
numfil = FreeFile 'numero de archivo libre
'abrir el archivo para leer
Open "D:\PROYECTO_CASA\software\casa\v1.3\titulo_nuevoParam.txt" For Input As numfil
i = 0: cont = 0
'Close #numfil
Do While Not EOF(numfil)
'Lee la linea
 Line Input #numfil, linea
 
 If i = 0 Then
 lbl1(i).Caption = linea
 txt(i).Visible = True
 Else
 Select Case band
 Case Is = 1 'FISICO
   If linea <> "ENSAYO MICROBIOLOGICO" Then
    If linea = "ENSAYO BASICO" Then
    Call tipoEnsayo(i - 1, linea, 0): 'i = i - 1
    Else
    Call cargar(i, linea, 0, 500)
    End If
   End If
   lbl3.Visible = False: cmbAnali.Visible = False
 Case Is = 2 'MICRO
    If linea = "ENSAYO BASICO" Then
    Call tipoEnsayo(i - 1, linea, 0): 'i = i - 1
    ElseIf linea = "ENSAYO MICROBIOLOGICO" Then
    Call tipoEnsayo(i, linea, 1)
: i = i - 1
    Else
    Call cargar(i, linea, 0, 800)
    End If
   ' costosParam.Height = 6800 '6540
   
   lbl3.Visible = False: cmbAnali.Visible = False
  Case Is = 3 'MOSTRAR LOS DATOS
  
    lbl3.Visible = True: cmbAnali.Visible = True
    If cmbAnali.ListIndex = 0 Then: cmb_ensayo.Enabled = False
    If linea = "ENSAYO BASICO" Then
    Call tipoEnsayo(i - 1, linea, 0): 'i = i - 1
    ElseIf linea = "ENSAYO MICROBIOLOGICO" Then
    Call tipoEnsayo(i, linea, 1)
    i = i - 1
    Else
    Call cargar(i, linea, 0, 800)
    End If
  End Select
 End If
 If band = 1 And linea <> "ENSAYO MICROBIOLOGICO" And linea <> "ENSAYO BASICO" Then
 i = i + 1
 ElseIf band = 2 And linea <> "ENSAYO BASICO" Then 'microbiologico
 i = i + 1
 ElseIf band = 3 And linea <> "ENSAYO BASICO" Then
 i = i + 1
 End If
 
 Loop
   costosParam.Height = txt(0).Height + costosParam.Height '6540 '6800
End Sub

Sub cargar(i As Long, texto As String, j As Integer, sum As Long)
 Load txt(i)
 Load lbl1(i)
If j = 0 Then
 If i <> 5 Then sum = 0
 txt(i).Top = txt(i - 1).Top + txt(i - 1).Height + sum '300 '270
 lbl1(i).Top = lbl1(i - 1).Top + txt(i - 1).Height + sum '300 '270
Else
 txt(i).Top = txt(i).Top + 300 '270
 lbl1(i).Top = lbl2(j).Top + 300 '270
End If
 lbl1(i).Caption = texto
 lbl1(i).Visible = True
 txt(i).Visible = True
End Sub
Sub tipoEnsayo(i As Long, texto, j As Long)
If j = 1 Then Load lbl2(j)
lbl2(j).Caption = texto
If j = 0 Then
lbl2(j).Top = lbl1(i).Top + txt(i).Height
opt_no.Top = lbl1(i).Top + txt(i).Height
opt_si.Top = lbl1(i).Top + txt(i).Height
opt_no.Visible = True: opt_si.Visible = True
Else
lbl2(j).Top = lbl2(j).Top + 300
cmb_ensayo.Top = opt_si.Top + 300: cmb_ensayo.Visible = True
End If
lbl2(j).Visible = True



End Sub
Private Sub cmbAnali_Click()

If cmbAnali.ListIndex = 1 Then
cmb_ensayo.Enabled = True: cmb_ensayo = ""
Else
cmb_ensayo.Enabled = False: cmb_ensayo = ""
End If

End Sub
Private Sub cmdAdd_Click()
Dim aux As String, aux1 As String
Dim tam As Long, i As Long

' GUARDAR ---
tam = txt.Count
'cmb_ensayo
If txt(0).Text <> "" And txt(1).Text <> "" And txt(2).Text <> "" And txt(3).Text <> "" And txt(4).Text <> "" Then


'basico
If opt_si.Value = True Then
aux = "'" & txt(0).Text & "','" & txt(2).Text & "','" & txt(10).Text & "','" & txt(11).Text & "','" & txt(5).Text & "','" & txt(4).Text & "','B'"
ElseIf opt_no.Value = True Then
aux = "'" & txt(0).Text & "','" & txt(2).Text & "','" & txt(10).Text & "','" & txt(11).Text & "','" & txt(5).Text & "','" & txt(4).Text & "','N'"
Else ' por defecto si no escoge va ser basico
aux = "'" & txt(0).Text & "','" & txt(2).Text & "','" & txt(10).Text & "','" & txt(11).Text & "','" & txt(5).Text & "','" & txt(4).Text & "','B'"
End If
'tipo analisis
Select Case band
Case Is = 1
'aux = aux & ",'fi','','n',0"
aux = aux & ",'fi','" & txt(6).Text & "','n',0"

Case Is = 2

If cmb_ensayo.ListIndex = 0 Then
'aux = aux & ",'mi','','bacte',0"
aux = aux & ",'mi','" & txt(6).Text & "','bacte',0"
ElseIf cmb_ensayo.ListIndex = 1 Then
'aux = aux & ",'mi','','parasi',0"
aux = aux & ",'mi','" & txt(6).Text & "','parasi',0"
ElseIf cmb_ensayo.ListIndex = 2 Then
'aux = aux & ",'mi','','viral',0"
aux = aux & ",'mi','" & txt(6).Text & "','viral',0"
ElseIf cmb_ensayo.ListIndex = 3 Then
'aux = aux & ",'mi','','otros',0"
aux = aux & ",'mi','" & txt(6).Text & "','otros',0"
End If

Case Is = 3
If cmbAnali.ListIndex = 0 Then
 aux = aux & ",'fi','" & txt(6).Text & "','n',0"
ElseIf cmbAnali.ListIndex = 1 Then
 Select Case cmb_ensayo.ListIndex
 Case Is = 0
 'aux = aux & ",'mi','','bacte',0"
 aux = aux & ",'mi','" & txt(6).Text & "','bacte',0"
 Case Is = 1
 'aux = aux & ",'mi','','parasi',0"
 aux = aux & ",'mi','" & txt(6).Text & "','parasi',0"
 Case Is = 2
 'aux = aux & ",'mi','','viral',0"
 aux = aux & ",'mi','" & txt(6).Text & "','viral',0"
 Case Is = 3
 'aux = aux & ",'mi','','otros',0"
 aux = aux & ",'mi','" & txt(6).Text & "','otros',0"
 End Select
End If

End Select

aux = "''," & aux & ",'" & txt(1).Text & "','" & txt(3).Text & "','" & txt(7).Text & "','" & txt(8).Text & "','" & txt(9).Text & "'"
'-- INSERTAR PARAMETRO
Call insertAdd("costos_quimicos1", aux)
  
'fin obligatorios
End If
End Sub
'Validar
Private Sub txt_KeyPress(Index As Integer, KeyAscii As Integer)

Select Case Index
Case Is = 0 'letras
Call validarText(KeyAscii, 1)
Case Is = 3 'numeros y .
Call validarText(KeyAscii, 16)
Case Is = 10, Is = 11 'numeros y ,
Call validarText(KeyAscii, 17)
End Select

'
End Sub
